﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using GeneralLibs;
using Lists;


namespace BI
{
    public partial class FrmShowBangDoanhSo : BasicForms.FrmBase
    {
        DataTable _Table = null;
        public FrmShowBangDoanhSo(DataTable table)
        {
            _Table = table;

            InitializeComponent();
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            try
            {
                switch (keyData)
                {

                    //case Keys.Escape:
                    //    this.Close();
                    //    return true;
                    //    break;
                    default:
                        return base.ProcessCmdKey(ref msg, keyData);
                        break;
                }
            }
            catch (Exception ex)
            {
                BasicForms.FrmExceptionNotifier.ShowAndLog(ex);
                return false;
            }
        }

        private void FrmShowBangDoanhSo_Load(object sender, EventArgs e)
        {
            try
            {
                if (_Table != null)
                {
                    //do trên biểu đồ chia đơn vị 1tr nên ở đây phải nhân lại
                    foreach (DataRow row in _Table.Rows)
                    {
                        row["Series1Value"] = (decimal)row["Series1Value"] * 1000000;
                        row["Series2Value"] = (decimal)row["Series2Value"] * 1000000;
                        row["Series3Value"] = (decimal)row["Series3Value"] * 1000000;
                    }
                    gridControl.DataSource = _Table;
                }

                FormatNumberInGridView(gridView);
            }
            catch (Exception ex)
            {
                BasicForms.FrmExceptionNotifier.ShowAndLog(ex);
            }
        }
    }
}
